import { defineStore } from "pinia";
import { Names } from "../../store-namespace";
import { _get, _post, _put, _delete, http } from "@/utils/axios";
import { WarningList } from "@/api/backend/index";

export const useWarningList = defineStore(Names.WarningList, {
  state: () => {
    return {
      single: <any>{},
      tags: <any>{},
      type: <any>[],
      typeLevel: <any>[], //告警级别
      typeCategory: <any>[], //告警类别
    };
  },
  getters: {},
  actions: {
    //获取告警信息列表数据
    getWarningListList(filter: any) {
      return new Promise((resolve, reject) => {
        _get(WarningList + "/list", filter, "json", "").then((res: any) => {
          console.log("获取告警信息列表数据", res);
          resolve(res);
        });
      });
    },
    //告警大盘接口
    getWarningMarket(filter: any) {
      return new Promise((resolve, reject) => {
        _get(WarningList + "/market", filter, "json", "").then((res: any) => {
          console.log("告警大盘接口", res);
          resolve(res);
        });
      });
    },
  },
});
